from datetime import datetime
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, DateTime, text, String
from sqlalchemy.dialects.mysql import INTEGER
from sqlalchemy import Integer, Table
__all__ = ['Base', 'RecodeMixinModel']

# 数据库模型基类
Base = declarative_base()


class BaseModel(Base):
    __abstract__ = True




class RecodeMixinModel:

    id = Column(Integer, autoincrement=True, primary_key=True, comment="自增ID")
    created_time = Column(DateTime, nullable=False, comment='创建时间')
    updated_time = Column(DateTime, nullable=False, comment='更新时间')
    deleted_time = Column(DateTime, nullable=False, comment='删除时间')
    created_by = Column(String(100), nullable=False, comment='创建者')
    updated_by = Column(String(100), nullable=False, comment='更新者')
    deleted_by = Column(String(100), nullable=False,  comment='删除者')
    is_deleted = Column(INTEGER(11), nullable=False,
                        server_default=text("'0'"), comment='是否删除')

